package com.sunny;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        String prevState = "empty";

        String state;

        while (scanner.hasNext()){

            String in = scanner.next();

            String[] ins = in.split("|");

            state = convert(prevState, ins[0], ins[2]);

            if(!state.equals(prevState)){
                System.out.print(ins[1] + "|" + state + ";");
            }

            prevState = state;
        }

    }

    public static String convert(String state, String source, String event) {

        if(state.equals("empty") && source.equals("RmApp") && event.equals("start")){
            return "submitted";
        }

        if(state.equals("submitted") && source.equals("ResourceScheduler") && event.equals("app_accepted")){
            return "scheduled";
        }

        if(state.equals("scheduled") && source.equals("RmContainer") && event.equals("container_allocated")){
            return "allocated";
        }

        if(state.equals("scheduled") && source.equals("ApplicationMasterLauncher") && event.equals("launched")){
            return "running";
        }

        if(state.equals("running") && source.equals("ResourceScheduler") && event.equals("finished")){
            return "finished";
        }

        if(!state.equals("finished") && !state.equals("empty") && source.equals("RmApp") && event.equals("kill")){
            return "killed";
        }

        return state;

    }

}
